package com.example.controller;

import com.example.common.result.Result;
import com.example.service.EquipmentService;
import com.example.service.UnitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@CrossOrigin // 跨域
@RestController
@RequestMapping("/api/Equipment")
@Api(tags = "设备台账控制台")
public class EquipmentController {

    @Resource
    private EquipmentService equipmentService;
    @Resource
    private UnitService unitService;

    @ApiOperation("分页条件查询")
    @PostMapping("/queryIPageList")
    @ResponseBody
    public Result queryIPageList(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, String code, String name, String uid) {
        return this.equipmentService.queryIPageList(current, size, code,name,uid);
    }

    @ApiOperation("条件查询设备台账页面左菜单")
    @PostMapping("/queryUnitList")
    @ResponseBody
    public Result queryUnitList(String name) {
        return this.unitService.queryUnitList(name);
    }
}
